//
//  MainConfig.m
//  DownDemo
//
//  Created by 喂！ on 2018/11/7.
//  Copyright © 2018年 well. All rights reserved.
//

#import "MainConfig.h"

@implementation MainConfig


static MainConfig *instance = nil;


#pragma mark - 单例模式初始化
+(MainConfig *)sharedInstance
{
    if(!instance)
    {
        instance=[[self alloc] init];
        [instance initData];
    }
    return instance;
}

#pragma mark - 单例内容初始化
-(void)initData
{
    //doc目录
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSFileManager *fileMgr = [NSFileManager defaultManager];
    NSString *dir = [paths objectAtIndex:0];
    instance.homeDir = dir;
    //doc -> LocalFile
    instance.localDir = [dir stringByAppendingPathComponent:@"LocalFile"];
    
    if (![fileMgr fileExistsAtPath:instance.localDir]) {
        [fileMgr createDirectoryAtPath:instance.localDir withIntermediateDirectories:YES attributes:nil error:nil];
    }
    
    
}


@end
